<% prefix = resource_name + titlelize(api.name) -%>
func build<%= prefix -%>Parameters(opts map[string]interface{}, arrayIndex map[string]int) (interface{}, error) {
    params := make(map[string]interface{})
<%= lines(build_expand_properties(api.parameters, "opts, arrayIndex", prefix, "params", true), 1) %>
<% if api.msg_prefix.nil? -%>
    return params, nil
<% else -%>
    if len(params) == 0 {
        return params, nil
    }

<%   items = api.msg_prefix.split(".")
     array_items = api.msg_prefix_array_items || []
-%>
<%   while !items.empty? do -%>
<%     ai = items.join(".") -%>
<%     if array_items.include?(ai) -%>
    params = map[string]interface{} {"<%= items.pop %>": []interface{} {params}}
<%     else -%>
    params = map[string]interface{} {"<%= items.pop %>": params}
<%     end%>
<%   end -%>
    return params, nil
<% end -%>
}

<% api.parameters.each do |prop| -%>
<%= lines(build_expand_method(resource, prefix, prop), 1) -%>
<% end -%>
